/*
* @description: 学生身份认证审核
* @Author: along
* @Date: 2019-08-24
* @Last Modified by: along
* @Last Modified time: 2020-08-24
*/
<template>
    <div class="container commentUserExaminer">
        <!-- header -->
        <div class="header-nav">
            <div class="header-left">
                <div class="header-new-box">
                    <p class="header-new-box-title">用户手机/ID/姓名:</p>
                    <el-input
                        v-model="formData.keyword"
                        placeholder="请输入手机/ID/姓名"
                        size="small"
                        clearable
                        suffix-icon="el-icon-search"
                        @change="getTableData(1)"
                        @keyup.native.enter="getTableData(1)"
                    />
                </div>
                <div class="header-new-box">
                    <p class="header-new-box-title">大学名称:</p>
                    <el-cascader
                        placeholder="请选择"
                        :options="school_tree"
                        filterable
                        clearable
                        change-on-select
                        expand-trigger="click"
                        v-model="keyword_school"
                        @change="getTableData(1)"
                        @keyup.native.enter="getTableData(1)"
                        :props="{
                            label: 'name',
                            value: 'id',
                            children: 'children'
                        }"
                        size="small"
                    />
                </div>

                <div class="header-new-box">
                    <p class="header-new-box-title">审核状态:</p>
                    <el-select
                        v-model="formData.audit"
                        clearable
                        filterable
                        placeholder="请选择"
                        size="small"
                        @change="getTableData(1)"
                    >
                        <el-option
                            v-for="item in auditList"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"/>
                    </el-select>
                </div>
                <div class="header-new-box">
                    <p class="header-new-box-title">审核人:</p>
                    <el-input
                        v-model="formData.aidit_user"
                        placeholder="请输入审核人"
                        size="small"
                        clearable
                        suffix-icon="el-icon-search"
                        @change="getTableData(1)"
                        @keyup.native.enter="getTableData(1)"
                    />
                </div>
                <div class="header-new-box">
                    <p class="header-new-box-title">提交时间:</p>
                    <el-date-picker
                        v-model="date"
                        type="datetimerange"
                        :picker-options="pickerOptions()"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        :default-time="['00:00:00', '23:59:59']"
                        align="right"
                        size="small"
                        @change="getTableData(1)"
                    />
                </div>
                <div class="header-new-box">
                    <el-button
                        type="primary"
                        size="small"
                        @click="getTableData(1)"
                    >
                        搜索
                    </el-button>
                </div>
            </div>
        </div>
        <!-- /header -->

        <!-- table -->
        <el-table
            :data="tableData"
            height="100%"
            style="width: 100%;"
            border
            ref="commentUserExaminer"
        >
            <el-table-column
                type="index"
                width="60"
                label="序号"
                align="center"
            />
            <el-table-column
                prop="student_no"
                label="申请编号"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
                :width="150"
            />
            <el-table-column
                prop="true_name"
                label="用户名称"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
            />
            <el-table-column
                prop="real_name"
                label="用户姓名"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
                width="120"
            >
                <template slot-scope="scope">
                    {{ scope.row.real_name }}
                    <i
                        class="iconfont el-icon-hand-tanhao3x"
                        style="color: #FF3030"
                        v-if="scope.row.has_same_verify_info"
                    />
                </template>
            </el-table-column>
            <el-table-column
                prop="phone"
                label="手机号"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
                :width="150"
            />
            <el-table-column
                prop="school"
                label="学校名称"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
            />
            <el-table-column
                prop="images"
                label="身份图片"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
            >
                <template slot-scope="scope">
                    <p
                        v-if="scope.row.images.length > 0"
                        class="cursor-font"
                        @click="fnShowPreview(scope.row.images, 0)"
                    >
                        查看({{ scope.row.images.length }})
                    </p>
                    <p v-else>
                        --
                    </p>
                </template>
            </el-table-column>
            <el-table-column
                prop="enter_school_year"
                label="入学年份"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
            />
            <el-table-column
                prop="finish_school_year"
                label="毕业年份"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
            />
            <el-table-column
                prop="submit_time"
                label="提交时间"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
                :width="150"
            >
                <template slot-scope="scope">
                    {{ scope.row.submit_time * 1000 | dateFormatter('yyyy/MM/dd HH:mm') }}
                </template>
            </el-table-column>
            <el-table-column
                prop="verify"
                label="审核状态"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
            >
                <template slot-scope="scope">
                    <p v-if="scope.row.verify == 1">通过</p>
                    <p v-if="scope.row.verify == -1">未通过</p>
                    <p v-if="scope.row.verify == 0">未审核</p>
                </template>
            </el-table-column>
            <el-table-column
                prop="verify_time"
                label="审核时间"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
                :width="150"
            >
                <template slot-scope="scope">
                    {{ scope.row.verify_time * 1000 | dateFormatter('yyyy/MM/dd HH:mm') }}
                </template>
            </el-table-column>
            <el-table-column
                prop="verify_admin_true_name"
                label="审核人"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
                :width="150"
            />
            <el-table-column
                prop="remark"
                label="备注"
                show-overflow-tooltip
                :formatter="emptyFormatter"
                align="center"
                :width="150"
            />
            <el-table-column
                label="操作"
                align="center"
                fixed="right"
            >
                <template slot-scope="scope">
                    <div class="button-list">
                        <el-button
                            type="text"
                            class="curse-add"
                            @click="fnEXamlineDialog(scope.row, scope.$index)"
                            v-if=" scope.row.verify == 0 "
                        >
                            审核
                        </el-button>
                        <el-button
                            type="text"
                            class="curse-add"
                            @click="fnSeeDialog(scope.row, scope.$index )"
                            v-if=" scope.row.verify !== 0 "
                        >
                            查看
                        </el-button>
                        <el-button
                            type="text"
                            class="curse-add"
                            @click="fnExamineAdopt(scope.row)"
                            :disabled=" scope.row.verify == 0 ? false : true "
                        >
                            通过
                        </el-button>
                        <el-button
                            type="text"
                            class="curse-add"
                            @click="fnExamineNoAdopt(scope.row, true)"
                            :disabled=" scope.row.verify == 0 ? false : true "
                        >
                            不通过
                        </el-button>
                        <el-button
                            type="text"
                            class="curse-add"
                            @click="fnBeizhu(scope.row)"
                        >
                            备注
                        </el-button>
                        <el-button
                            type="text"
                            class="curse-add"
                            :disabled="scope.row.verify === 0"
                            @click="fnExamineAgain(scope.row)"
                        >
                            重新审核
                        </el-button>
                    </div>
                </template>
            </el-table-column>
        </el-table>
        <!-- /table -->

        <!-- /分页 -->
        <div class="pagination-wrapper clearfix">
            <el-pagination
                background
                layout="total, prev, pager, next"
                :current-page.sync="page.now_page"
                :total="page.total_count"
                :page-size="page.page_size"
                @current-change="getTableData"
            />
        </div>

        <!-- 审核弹窗 -->
        <el-dialog
            :visible.sync="dialogVisible"
            :close-on-click-modal="false"
            :title=" '用户信息' "
            width="620px"
        >
            <div class="zd-examine">
                <div class="zd-examine-list">
                    <p class="zd-head-title">当页进度:</p>
                    <div class="zd-examine-line" >
                        <p
                            :style="{ width: 200 * (pageIndex + 1) / pageSize + 'px' }"
                            class="zd-examine-line-length"
                        />
                    </div>
                    <p class="zd-examine-page">{{ (pageIndex + 1) + '/' + pageSize }}</p>
                </div>
                <div class="zd-examine-list">
                    <p class="zd-head-title">审核人:</p>
                    <div class="zd-info">
                        <p class="zd-info-label">{{ dialogData.verify_admin_true_name ? dialogData.verify_admin_true_name : '--' }}</p>
                    </div>
                </div>
                <!-- <div
                    class="zd-examine-list"
                    v-if="dialogData.verify_time"
                >
                    <p class="zd-head-title">审核时间:</p>
                    <div class="zd-info">
                        <p class="zd-info-label">{{ dialogData.verify_time * 1000 | dateFormatter('yyyy/MM/dd HH:mm') }}</p>
                    </div>
                </div> -->
                <div
                    class="zd-examine-list"
                    v-if="dialogData.enter_school_year"
                >
                    <p class="zd-head-title">入学年份:</p>
                    <div class="zd-info">
                        <p class="zd-info-label">{{ dialogData.enter_school_year }}</p>
                    </div>
                </div>
                <div
                    class="zd-examine-list"
                    v-else
                >
                    <p class="zd-head-title">入学年份:</p>
                    <div class="zd-info">
                        <p class="zd-info-label">--</p>
                    </div>
                </div>
                <div
                    class="zd-examine-list"
                    v-if="dialogData.finish_school_year"
                >
                    <p class="zd-head-title">毕业年份:</p>
                    <div class="zd-info">
                        <p class="zd-info-label">{{ dialogData.finish_school_year }}</p>
                    </div>
                </div>
                <div
                    class="zd-examine-list"
                    v-else
                >
                    <p class="zd-head-title">毕业年份:</p>
                    <div class="zd-info">
                        <p class="zd-info-label">--</p>
                    </div>
                </div>
                <div class="zd-examine-list">
                    <p class="zd-head-title">{{ dialog_status ? '审核' : '查看' }}内容:</p>
                    <div class="zd-info">
                        <p class="zd-info-label">真实姓名:
                            {{ dialogData.real_name ? dialogData.real_name : '--' }}
                            <i
                                class="iconfont el-icon-hand-tanhao3x"
                                style="color: #FF3030"
                                v-if="dialogData.has_same_verify_info"
                            />
                        </p>
                        <!-- 审核后显示&&更改大学 -->
                        <p
                            class="zd-info-label"
                            v-if="dialogData.verify !== 0 && dialogData.history_school"
                        >
                            历史大学: {{ dialogData.history_school }}
                        </p>
                        <p class="zd-info-label">
                            {{ dialogData.history_school ? '更改后大学' : '用户大学' }}: {{ dialogData.school ? dialogData.school : '--' }}
                            <i
                                v-if="dialogData.verify == 0"
                                class="el-icon-edit"
                                @click="fnChangeSchool(dialogData)"
                            />
                        </p>
                        <!-- 审核后显示&&更改大学 -->
                        <!-- <p
                            class="zd-info-label"
                            v-if="dialogData.verify !== 0 && true"
                        >
                            更改人: {{ '我是测试数据' }}
                        </p> -->
                        <div
                            class="zd-info-label"
                            :style="{width: '460px', display: 'flex'}"
                        >
                            身份图片{{ dialogData.images ? `(${dialogData.images.length})` : '' }}:
                            <!-- <img
                                v-for="(item,index) in dialogData.images"
                                :key="index"
                                :src="item"
                                :style="{width: '80px', height: '80px', marginLeft: '10px'}"
                                @click="fnShowPreview(dialogData.images, index)"
                            > -->
                            <el-image
                                v-for="(item,index) in dialogData.images"
                                :style="{width: '80px', height: '80px', marginLeft: '10px'}"
                                :key="index"
                                :src="item"
                                :preview-src-list="dialogData.images"
                            />
                        </div>
                    </div>
                </div>
                <div
                    class="zd-examine-list"
                    style="align-items: center"
                    :style="{ 'pointerEvents' : dialog_status ? '' : 'none' }"
                >
                    <p class="zd-head-title">不通过理由:</p>
                    <el-input
                        type="textarea"
                        :autosize="{ minRows: 2, maxRows: 6}"
                        placeholder="请输入内容"
                        v-model="reason"
                    />
                </div>
                <div class="zd-foot">
                    <div class="zd-foot-left">
                        <el-button
                            type="primary"
                            size="mini"
                            style="margin-right: 10px"
                            @click="fnExamineAdopt(dialogData)"
                            v-if="dialog_status"
                        >
                            通过
                        </el-button>
                        <el-button
                            size="mini"
                            @click="fnExamineNoAdopt(dialogData, false)"
                            v-if="dialog_status"
                        >
                            不通过
                        </el-button>
                        <el-tag
                            type="info"
                            style="cursor: not-allowed"
                            v-if="!dialog_status && (dialogData.verify === 1) "
                        >
                            审核通过
                        </el-tag>
                        <el-tag
                            type="info"
                            style="cursor: not-allowed"
                            v-if="!dialog_status && (dialogData.verify === -1) "
                        >
                            审核未通过
                        </el-tag>
                    </div>
                    <div class="zd-foot-right">
                        <i class="el-icon-arrow-left"/>
                        <p
                            class="zd-foot-prev"
                            @click="fnPrevtData()"
                        >
                            上一条反馈
                        </p>
                        <p
                            class="zd-foot-next"
                            @click="fnNexttData()"
                        >
                            下一条反馈
                        </p>
                        <i class="el-icon-arrow-right"/>
                    </div>
                </div>
            </div>
        </el-dialog>

        <!-- 备注内容 -->
        <el-dialog
            title="备注内容"
            width="530px"
            custom-class="schedule-dialog"
            :visible.sync="showMask"
        >
            <el-form
                :model="ruleFormMask"
                :rules="rulesMask"
                ref="ruleFormMask"
            >
                <el-form-item
                    prop='reportCont'
                >
                    <el-input
                        type="textarea"
                        :autosize="{ minRows: 2, maxRows: 4}"
                        placeholder="请输入内容"
                        v-model="ruleFormMask.reportCont"
                    />
                </el-form-item>
            </el-form>
            <div
                slot="footer"
                class="dialog-footer"
                :style="{marginTop: '-20px'}"
            >
                <el-button
                    size="small"
                    type="primary"
                    :style="{width: '120px', height: '32px'}"
                    @click="submitForm('ruleFormMask')">提交</el-button>
            </div>
        </el-dialog>
        <!-- 备注内容 -->

        <!-- 修改学校弹窗 -->
        <el-dialog
            title="修改学校"
            :visible.sync="dialogVisibleSchool"
            width="610px"
        >
            <span>学校名称:</span>
            <el-cascader
                placeholder="请选择"
                :options="school_tree"
                filterable
                clearable
                change-on-select
                expand-trigger="click"
                v-model="school_name_edit"
                :props="{
                    label: 'name',
                    value: 'id',
                    children: 'children'
                }"
                size="small"
                style="width:80%"
            />
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button
                    type="primary"
                    size="small"
                    @click='submitEditForm()'
                    :style="{width: '120px', height: '32px'}"
                >
                    确定
                </el-button>
            </span>
        </el-dialog>
        <!-- /修改学校弹窗 -->

        <!-- 图片预览 -->
        <img-preview ref="preview" />
    </div>
</template>

<script>
import imgPreview from '@/components/common/img-preview';
import { back } from '@/mixin/back';
import { getDate } from '@/assets/js/utils';
import { mapState } from 'vuex';
export default {
    mixins: [back],
    components: {
        imgPreview
    },
    data () {
        return {
            keyword_school: '',
            change_school_id: '',
            options: {},
            school_name_edit: '',
            school_tree: [],
            dialogVisibleSchool: false,
            student_no: '', //记录编号
            ruleFormMask: {
                reportCont: ''
            },
            rulesMask: {
                reportCont: [
                    { required: true, message: '请填写备注内容', trigger: 'blur' }
                ]
            },
            showMask: false,
            //审核弹窗
            dialogData: {},
            dialog_status: true,
            reason: '',
            pageIndex: 0,
            pageSize: 0,
            dialogVisible: false,
            //筛选字段
            formData: {
                keyword: '',
                audit: 99,
                aidit_user: '',
                date: []
            },
            date: [],
            auditList: [{value: 99,label: '全部'},{value: 1,label: '通过'},{value: -1,label: '不通过'},{value: 0,label: '未审核'}],
            page: {
                now_page: 1,
                total_count: 0,
                page_size: 0
            },
            tableData: [],
            authResult: {}
        };
    },
    filters: {},
    computed: {
        ...mapState({
            userInfo: state => state.userinfo.userinfo,
        })
    },
    watch: {
        showMask (val) {
            if(!val) {
                this.$refs['ruleFormMask'].resetFields();
            }
        }
    },
    mounted () {
        this.authResult = this.$route.meta.authResult;
        this.getTableData();
        this.getSchoolTree();
    },
    methods: {
        /**
         * @description 获取表格数据
         */
        getTableData (page) {
            this.$post('/student/student_user_student_verify%5Cget_list', {
                page_id: page || this.page.now_page,
                keyword_student_id: this.formData.keyword,
                verify: this.formData.audit,
                verify_admin_true_name: this.formData.aidit_user,
                submit_start_time: this.date === null ? '' : (this.date.length == 0 ? '' : getDate(new Date(this.date[0]))),
                submit_end_time: this.date === null ? '' : (this.date.length == 0 ? '' : getDate(new Date(this.date[1]))),
                keyword_school_id: this.keyword_school.length > 0 ? this.keyword_school[2] : '',
                version: 1
            }, resp => {
                if (resp.code == 1) {
                    this.tableData = resp.data.list;
                    this.page.now_page = resp.data.page.now_page;
                    this.page.total_count = resp.data.page.total_count;
                    this.page.page_size = resp.data.page.page_size;

                    //计算当前页数据数量
                    if(resp.data.page.total_count == 1) {
                        this.pageSize = resp.data.page.total_count;
                    } else if (resp.data.page.total_count > 1 && resp.data.page.next_page > 0) {
                        this.pageSize = 20;
                    } else if (resp.data.page.total_count > 1 && resp.data.page.next_page == 0) {
                        this.pageSize = resp.data.page.total_count - (resp.data.page.now_page - 1) * 20;
                    }
                }
            });
        },

        /**
         * @description 获取省/市/学校三级联动
         */
        getSchoolTree () {
            this.$post('/student/local_info%5Cschool_tree',{},resp => {
                if (resp.code == 1) {
                    this.school_tree = resp.data.tree;
                }
            });
        },

        /**
         * @description 打开修改学校弹窗
         */
        fnChangeSchool (row) {
            this.student_no = row.student_no;
            this.school_name_edit = row.school_id;
            this.dialogVisibleSchool = !this.dialogVisibleSchool;
        },

        /**
         * @description 修改学校
         */
        submitEditForm(formName) {
            this.dialogVisibleSchool = false;

            let school_id = this.school_name_edit.length > 0 ? this.school_name_edit[2] : '';
            let school_name = '';

            this.change_school_id = school_id;

            if(school_id) {
                this.school_tree.forEach(option => {
                    if(option.id == this.school_name_edit[0]) {
                        if(!!option.children) {
                            option.children.forEach(item => {
                                if(item.id == this.school_name_edit[1]) {
                                    if(!!item.children) {
                                        item.children.forEach(next => {
                                            if(next.id == school_id) {
                                                this.options = next;
                                                this.$set(this.dialogData, 'school', next.name);
                                                //TODO
                                                console.log('next', next);
                                            }
                                        });
                                    }
                                }
                            });
                        }
                    }
                });
            }

            // this.$post('/student/student_user%5Cchange_school', {
            //     student_no: this.student_no,
            //     school_id: this.school_name_edit.length > 0 ? this.school_name_edit[2] : ''
            // }, resp => {
            //     if (resp.code == 1) {
            //         this.$notify({
            //             title: '提示',
            //             message: '修改成功',
            //             type: 'success',
            //             duration: 2000
            //         });
            //     } else if (resp.code == 0) {
            //         this.$notify({
            //             title: '提示',
            //             message: resp.msg,
            //             type: 'warning',
            //             duration: 2000
            //         });
            //     }
            // });
        },

        /**
         * @description 审核
         */
        fnEXamlineDialog (row, index) {
            this.dialogData = {
                ...row
            };
            this.pageIndex = index;
            this.dialog_status = true;
            this.dialogVisible = !this.dialogVisible;
        },

        /**
         * @description 查看
         */
        fnSeeDialog (row, index) {
            this.dialogData = {
                ...row
            };
            this.reason = row.verify_fail_reason;
            this.dialog_status = false;
            this.pageIndex = index;
            this.dialogVisible = !this.dialogVisible;
        },

        /**
         * @description 审核通过
         */
        fnExamineAdopt (row) {
            if(!this.authResult.auth_verfy) {
                this.$notify({
                    title: '提示',
                    message: '此权限仅限管理员',
                    type: 'warning',
                    duration: 2000
                });
                return;
            }

            this.$confirm('是否确定通过审核？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$post('/student/student_user_student_verify%5Cverify',{
                    student_no: row.student_no,
                    verify: 1,
                    change_school_id: this.change_school_id
                }, resp => {
                    if (resp.code == 1) {
                        this.getTableData();
                        this.dialog_status = false;
                        this.change_school_id = '';
                        this.dialogData = this.tableData[this.pageIndex];
                        this.$set(this.dialogData, 'verify', 1);
                        this.$notify({
                            title: '提示',
                            message: '操作成功',
                            type: 'success',
                            duration: 2000
                        });
                    } else {
                        this.$notify({
                            title: '提示',
                            message: resp.msg,
                            type: 'warning',
                            duration: 2000
                        });
                    }
                });
            });
        },

        /**
         * @description 重新审核
         */
        fnExamineAgain (row) {
            if(!this.authResult.auth_verify_again) {
                this.$notify({
                    title: '提示',
                    message: '此权限仅限管理员',
                    type: 'warning',
                    duration: 2000
                });
                return;
            }

            this.$confirm('是否确定重新审核？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$post('/student/student_user_student_verify%5Creset',{
                    student_no: row.student_no
                }, resp => {
                    if (resp.code === 1) {
                        this.getTableData();
                        this.$notify({
                            title: '提示',
                            message: '操作成功',
                            type: 'success',
                            duration: 2000
                        });
                    } else {
                        this.$notify({
                            title: '提示',
                            message: resp.msg,
                            type: 'warning',
                            duration: 2000
                        });
                    }
                });
            });
        },

        /**
         * @description 审核不通过
         */
        fnExamineNoAdopt (row, type) {
            if(!this.authResult.auth_verfy) {
                this.$notify({
                    title: '提示',
                    message: '此权限仅限管理员',
                    type: 'warning',
                    duration: 2000
                });
                return;
            }

            if(type) {
                this.$prompt('请输入不通过原因', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    inputPattern: /\S/,
                    inputErrorMessage: '内容不可以为空'
                }).then(({ value }) => {
                    this.$post('/student/student_user_student_verify%5Cverify',{
                        student_no: row.student_no,
                        verify: -1,
                        verify_fail_reason: value
                    }, resp => {
                        if (resp.code == 1) {
                            this.getTableData();
                            this.dialog_status = false;
                            this.$notify({
                                title: '提示',
                                message: '操作成功',
                                type: 'success',
                                duration: 2000
                            });
                            this.change_school_id = '';
                        } else {
                            this.$notify({
                                title: '提示',
                                message: resp.msg,
                                type: 'warning',
                                duration: 2000
                            });
                        }
                    });
                });
            }

            if(!type) {
                if (this.reason == '') {
                    this.$message({
                        type: 'waring',
                        message: '请填写不通过理由,不可以为空',
                        center: true
                    });
                    return;
                } else {
                    this.$post('/student/student_user_student_verify%5Cverify',{
                        student_no: this.dialogData.student_no,
                        verify: -1,
                        verify_fail_reason: this.reason,
                        change_school_id: this.change_school_id
                    }, resp => {
                        if (resp.code == 1) {
                            this.getTableData();
                            this.dialog_status = false;
                            this.dialogData = this.tableData[this.pageIndex];
                            this.$set(this.dialogData, 'verify', -1);
                            this.change_school_id = '';
                            this.$notify({
                                title: '提示',
                                message: '操作成功',
                                type: 'success',
                                duration: 2000
                            });
                        } else {
                            this.$notify({
                                title: '提示',
                                message: resp.msg,
                                type: 'warning',
                                duration: 2000
                            });
                        }
                    });
                }
            }
        },

        /**
         * @description 上一条
         */
        fnPrevtData () {
            if(this.pageIndex == 0) {
                this.$notify({
                    title: '提示',
                    message: '当前已经是第一条了',
                    type: 'warning',
                    duration: 2000
                });
                return;
            }

            this.pageIndex--;
            this.dialogData = this.tableData[this.pageIndex];
            this.dialog_status = this.dialogData.verify == 0 ? true : false;
            this.change_school_id = '';
            if(!this.dialog_status) {
                this.reason = this.dialogData.verify_fail_reason;
            }
        },

        /**
         * @description 下一条
         */
        fnNexttData () {
            if(this.pageIndex == this.pageSize - 1) {
                this.$notify({
                    title: '提示',
                    message: '当前已经是最后一条了',
                    type: 'warning',
                    duration: 2000
                });
                return;
            }
            this.pageIndex++;
            this.dialogData = this.tableData[this.pageIndex];
            this.dialog_status = this.dialogData.verify == 0 ? true : false;
            this.change_school_id = '';
            if(!this.dialog_status) {
                this.reason = this.dialogData.verify_fail_reason;
            }
        },

        /**
         * @description 打开备注弹窗
         */
        fnBeizhu (row) {
            this.student_no = row.student_no;
            this.showMask = !this.showMask;
        },

        /**
         * @description 提交备注
         */
        submitForm (formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    this.$post('/student/student_user_student_verify%5Cremark',{
                        student_no: this.student_no,
                        remark: this.ruleFormMask.reportCont
                    },resp=>{
                        if (resp.code == 1) {
                            this.getTableData();
                            this.showMask = !this.showMask;
                            this.$notify({
                                title: '提示',
                                message: '操作成功',
                                type: 'success',
                                duration: 2000
                            });
                        } else if (resp.code == 0) {
                            this.$notify({
                                title: '提示',
                                message: resp.msg,
                                type: 'warning',
                                duration: 2000
                            });
                        }
                    });
                } else {
                    console.log('error submit!!');
                    return false;
                }
            });
        },

        /**
         * @description 查看图片
         * @param   {String}    images    单图预览
         * @param   {Array}     images     多图预览
         */
        fnShowPreview(images, index) {
            if(images && Object.prototype.toString.call(images) == '[object String]') {
                this.$refs.preview.show([
                    images
                ]);
            } else if (images && Object.prototype.toString.call(images) == '[object Array]') {
                this.$refs.preview.show(images, index);
            } else {
                this.$notify({
                    title: '提示',
                    message: '图片类型错误',
                    type: 'warning',
                    duration: 2000
                });
            }
        },

        /**
         * @description 时间处理
         */
        pickerOptions () {
            return {
                shortcuts : [{
                    text: '最近一周',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();

                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近一个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();

                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                        picker.$emit('pick', [start, end]);
                    }
                }, {
                    text: '最近三个月',
                    onClick(picker) {
                        const end = new Date();
                        const start = new Date();

                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                        picker.$emit('pick', [start, end]);
                    }
                }]
            };
        },

        /**
         * @description 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        }
    }
};
</script>

<style lang="less" scoped>
.container {
    background-color: #fff;
    padding: 10px 15px 5px 15px;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    .header-nav {
        position: relative;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        .header-left, .header-right {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
        }
        .header-new-box {
            display: flex;
            margin-right: 15px;
            align-items: center;
            color: #606266;
            margin-bottom: 10px;
            white-space: nowrap;
            &-title {
                margin-right: 2px;
                white-space: nowrap;
            }
        }
    }
    /* 表单 */
    .scope-price {
        width: 50px;
        height: 50px;
    }
    /* 字体高亮 */
    .cursor-font {
        color: rgb(64, 158, 255);
        cursor: pointer;
    }
    /* 分页 */
    .pagination-wrapper {
        padding-top: 10px;
        padding-bottom: 10px;
        .el-pagination {
            float: right;
            padding: 0;
            background-color: transparent;
        }
    }
}
.el-button-left {
    margin-left: 40px;
}
.el-button-right {
    margin-right: 10px;
}
.button-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    .el-button {
        margin-left: 0 !important;
        padding: 5px 0;
    }
}
.dialog-footer {
    display: flex;
    justify-content: center;
}
/* 审核弹窗 */
.zd-examine {
    width: 100%;
    .zd-examine-list {
        min-height: 20px;
        display: flex;
        padding-bottom: 30px;
        box-sizing: border-box;
        align-items: flex-start;
        .zd-head-title {
            color: #606285;
            font-size: 14px;
            margin-right: 20px;
            white-space: nowrap;
            width: 65px;
        }
        .zd-info {
            width: 460px;
            display: flex;
            flex-wrap: wrap;
            .zd-info-label {
                width: 230px;
                min-height: 20px;
                font-size: 14px;
                color: #333;
                margin-bottom: 15px;
                white-space: nowrap;
                cursor: pointer;
                &:hover {
                    i {
                        color: rgb(64, 158, 255);

                    }
                }
            }
        }
        .zd-examine-line {
            width: 200px;
            height: 12px;
            border-radius: 6px;
            background: rgba(64, 158, 255, .2);
            .zd-examine-line-length {
                height: 12px;
                border-radius: 6px;
                background: rgba(64, 158, 255, 1);
                transition: all .5s;
            }
        }
        .zd-examine-page {
            font-size: 14px;
            color: #333;
            margin-left: 10px;
        }
    }
    .zd-foot {
        display: flex;
        justify-content: space-between;
        .zd-foot-left, .zd-foot-right {
            display: flex;
            height: 32px;
            align-items: center;
            cursor: pointer;
            user-select:none;
            .zd-foot-prev {
                font-size: 14px;
                color: #333;
                margin-right: 15px;
                // &:hover {
                //     color: #20a0ff;
                // }
            }
            .zd-foot-next {
                font-size: 14px;
                color: #333;
                // &:hover {
                //     color: #20a0ff;
                // }
            }
        }
    }
}
</style>
<style lang="less">
.commentUserExaminer{
    .el-table__body-wrapper .el-table__body .el-table__row td {
        border-right: none;
    }
    .el-table__header-wrapper .el-table__header .has-gutter tr th {
        border-right: none;
    }
    .el-table .el-table_1_column_6  .cell {
        position: relative;
    }
    .el-range-editor--small .el-range-separator{
        padding: 0 1px !important;
    }
    .el-dialog__header {
        padding-top: 10px;
        box-shadow:0px 1px 0px 0px rgba(233,233,233,1);
        display: flex;
        align-items: center;
        background: #FAFAFA;
        border-radius: 4px 4px 0 0;
        .el-dialog__title {
            font-weight: 500;
            color: #333;
            font-size: 14px;
        }
        .el-icon-close:before {
            color: rgb(194,194,194);
            font-size: 17px;
            font-weight: bold;
        }
        .el-dialog__headerbtn {
            top: 14px;
        }
    }
}
</style>
